package com.example.demo.laws.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import com.example.demo.laws.dao.AeolLawsMapper;
import com.example.demo.laws.pojo.AeolLaws;

/**
 * 
 * <p>
 * 功能描述：法律法规 service 实现类
 * </p>
 * 
 * @author lixh
 * @date 2019年1月11日 上午9:35:39
 * @version 1.0
 */
@Service
@Transactional
public class AeolLawsServiceImpl {

	@Autowired
	AeolLawsMapper aeollawsmapper;

	public AeolLaws getAeolLaws(String id) {
		if (StringUtils.isEmpty(id)) {
			return null;
		}
		AeolLaws aeollaws = aeollawsmapper.selectByPrimaryKey(Long.valueOf(id));
		return aeollaws;
	}

	public List<AeolLaws> getAeolLawse(AeolLaws aeollaws) {

		return null;
	}

	public int delete(String id) {
		if (StringUtils.isEmpty(id)) {
			return 0;
		}
		return aeollawsmapper.deleteByPrimaryKey(Long.valueOf(id));
	}

	public int delteteW(AeolLaws aeollaws) {
		if (StringUtils.isEmpty(aeollaws)) {
			return 0;
		}
		aeollaws.setDataStatus("0");
		return aeollawsmapper.updateByPrimaryKeySelective(aeollaws);
	}

	public String add(AeolLaws aeollaws) {
		if (StringUtils.isEmpty(aeollaws)) {
			return null;
		}
		aeollaws.setDataStatus("1");
		aeollaws.setCreateTime(new Date());
		return String.valueOf(aeollawsmapper.insert(aeollaws));
	}

	public int update(AeolLaws aeollaws) {
		if (StringUtils.isEmpty(aeollaws.getLawNo())) {
			return 0;
		}
		return aeollawsmapper.updateByPrimaryKeySelective(aeollaws);
	}

	public List<Map<String, Object>> getLawsList(Map map) {
		return aeollawsmapper.getLawList(map);
	}

	public Long getLawsNo() {
		return aeollawsmapper.getLawsNo();
	}
}
